<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>体育与健康课程管理系统</title>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/public/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/public/css/main.css"/>
    <link href="${pageContext.request.contextPath}/public/bootstrap/css/bootstrap.min.css" rel="stylesheet">
    <script type="text/javascript" src="${pageContext.request.contextPath}/public/js/libs/modernizr.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/public/js/jquery-3.2.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/public/js/layer/layer.js"></script>
    <script src="${pageContext.request.contextPath}/public/laydate/laydate.dev.js"></script>
</head>
<body>
<div class="container clearfix" style="width:100%">
    <!--/sidebar-->
    <div class="main-wrap">

        <div class="crumb-wrap">
            <div class="crumb-list" style="background:#fff; border:0px"><i class="icon-font"></i>修改体育技能一考试安排</div>
        </div>
        <div class="result-wrap">
            <div class="result-content">
                <form  id="myform">
                    <table class="insert-tab" width="100%">
                        <tbody>
                        <tr>
                            <th><i class="require-red">*</i>选择考试周：</th>
                            <td>
                                <select name="systemExamWeeklyId"  style="height:32px" class="required">
                                    <option value="${peExamination.systemExamWeeklyId }">${peExamination.systemExamWeekly.systemExamWeeklyName }</option>
                                    <c:forEach items="${week }" var="y">
                                        <option value="${y.systemExamWeeklyId}">${y.systemExamWeeklyName }</option>
                                    </c:forEach>
                                </select>
                                </select>

                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>考试名称：</th>
                            <td>
                                <input name='peExaminationId' style="display:none" type="text" value="${peExamination.peExaminationId }" />
                                <input class="common-text required" id="title" name="peExaminationName" size="85" value="${peExamination.peExaminationName } " style="width:300px;height:32px" type="text">
                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>体育课技能：</th>
                            <td>
                                <select name="peExaminationClassId" id="catid" style="height:32px" class="required">
                                    <option value="${peExamination.peExaminationClassId }">${peExamination.peExaminationClass.peExaminationClassName }</option>
                                    <c:forEach items="${examinationClass }" var="x">
                                        <option value="${x.peExaminationClassId}">${x.peExaminationClassName }</option>
                                    </c:forEach>
                                </select>
                                </select>

                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>考试地点：</th>
                            <td>
                                <input class="common-text required" id="title" name="peExaminationPlace" size="85" value="${peExamination.peExaminationPlace }" style="width:300px;height:32px" type="text">
                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>开始时间：</th>
                            <td>
                                <input class="common-text required" id="title" name="peExaminationStarTime" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD/hh:mm:ss'})" size="85" value=<fmt:formatDate value="${peExamination.peExaminationStarTime}"  pattern="yyyy-MM-dd/HH:mm:ss"/> style="width:300px;height:32px" type="text">
                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>结束时间：</th>
                            <td>
                                <input class="common-text required" id="title" name="peExaminationEndTime" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD/hh:mm:ss'})" size="85" value=<fmt:formatDate value="${peExamination.peExaminationEndTime}" pattern="yyyy-MM-dd/HH:mm:ss"/> style="width:300px;height:32px" type="text">
                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>人数上限：</th>
                            <td>
                                <input class="common-text required" id="title" name="peExaminationUpperLimit" size="85" value="${peExamination.peExaminationUpperLimit }" type="text" onkeyup="value=value.replace(/[^\d.]/g,'')" style="width:300px;height:32px">
                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>人数下限：</th>
                            <td>
                                <input class="common-text required" id="title" name="peExaminationLowerLimit" size="85" value="${peExamination.peExaminationLowerLimit }" type="text" onkeyup="value=value.replace(/[^\d.]/g,'')" style="width:300px;height:32px">
                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>预约开始时间：</th>
                            <td>
                                <input class="common-text required" id="title" name="orderStartTime" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD/hh:mm:ss'})" size="85" value=<fmt:formatDate value="${peExamination.orderStartTime}"  pattern="yyyy-MM-dd/HH:mm:ss"/> style="width:300px;height:32px" type="text">
                            </td>
                        </tr>
                        <tr>
                            <th><i class="require-red">*</i>预约结束时间：</th>
                            <td>
                                <input class="common-text required" id="title" name="orderEndTime" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD/hh:mm:ss'})" size="85" value=<fmt:formatDate value="${peExamination.orderEndTime}" pattern="yyyy-MM-dd/HH:mm:ss"/> style="width:300px;height:32px" type="text">
                            </td>
                        </tr>
                        <tr>
                            <th></th>
                            <td>
                                <input class="btn btn-primary btn6 mr10" value="提交" type="button">
                                <input class="btn btn6"  onclick="history.go(-1)" value="返回" type="button">
                            </td>
                        </tr>
                        </tbody></table>
                </form>
            </div>
        </div>

    </div>
    <!--/main-->
</div>
</body>
<script type="text/javascript">
    $('.mr10').click(function(){
        var systemExamWeeklyId=$('select[name=systemExamWeeklyId]');
        var peExaminationId=$('input[name=peExaminationId]');
        var peExaminationName=$('input[name=peExaminationName]');
        var peExaminationPlace=$('input[name=peExaminationPlace]');
        var peExaminationStarTime=$('input[name=peExaminationStarTime]');
        var peExaminationEndTime=$('input[name=peExaminationEndTime]');
        var peExaminationUpperLimit=$('input[name=peExaminationUpperLimit]');
        var peExaminationLowerLimit=$('input[name=peExaminationLowerLimit]');
        var peExaminationClassId=$('select[name=peExaminationClassId]');
        var orderStartTime=$('input[name=orderStartTime]');
        var orderEndTime=$('input[name=orderEndTime]');

        if(peExaminationName.val()=="")
        {
            layer.msg('考试名称不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            peExaminationName.focus();
            return ;
        }
        if(peExaminationPlace.val()=="")
        {
            layer.msg('考试地点不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            peExaminationPlace.focus();
            return ;
        }


        if(peExaminationStarTime.val()=="")
        {
            layer.msg('开始时间不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            peExaminationStarTime.focus();
            return ;
        }

        if(peExaminationEndTime.val()=="")
        {
            layer.msg('结束时间不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            peExaminationEndTime.focus();
            return ;
        }
        if(peExaminationUpperLimit.val()=="")
        {
            layer.msg('人数上限不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            peExaminationUpperLimit.focus();
            return ;
        }
        if(peExaminationLowerLimit.val()=="")
        {
            layer.msg('考试人数下限不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            peExaminationLowerLimit.focus();
            return ;
        }
        if(orderStartTime.val()=="")
        {
            layer.msg('预约开始时间不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            orderStartTime.focus();
            return ;
        }

        if(orderEndTime.val()=="")
        {
            layer.msg('预约结束时间不能为空', { offset: ['0px', '40%'], icon:7,time:2000});
            orderEndTime.focus();
            return ;
        }

        var StartTime = peExaminationStarTime.val().replace("/"," ");
        var EndTime	= peExaminationEndTime.val().replace("/"," ");
        var orderStartTime = orderStartTime.val().replace("/"," ");
        var orderEndTime = orderEndTime.val().replace("/"," ");

        $.post("${pageContext.request.contextPath}/skilltest2/updatefun.action",{peExaminationId:peExaminationId.val(),peExaminationName:peExaminationName.val(),
            peExaminationPlace:peExaminationPlace.val(),peExaminationStarTime:StartTime,peExaminationEndTime:EndTime,peExaminationUpperLimit:peExaminationUpperLimit.val(),
            peExaminationLowerLimit:peExaminationLowerLimit.val(),peExaminationClassId:peExaminationClassId.val(),orderStartTime:orderStartTime,orderEndTime:orderEndTime,systemExamWeeklyId:systemExamWeeklyId.val()},function(returndata)
        {
            if(returndata.code==1){
                layer.msg(returndata.message, { offset: ['0px', '40%'], icon:6,time:1000},function(){
                    window.location.href="${pageContext.request.contextPath}/skilltest2/selectweek.action?systemExamWeeklyId="+systemExamWeeklyId.val();
                });
            }
            else
                layer.msg(returndata.message, { offset: ['0px', '40%'], icon:5,time:2000});
        });

    });
</script>
</html>